package cn.lisynet.api.controller;

import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.lisynet.api.service.PdTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lisy
 */
@RestController
public class HomeController {
    @Autowired
    private PdTaskService taskService;
    @RequestMapping("/home")
    public String home(String sn){
        if(StrUtil.isBlank(sn)){
            sn = IdUtil.fastSimpleUUID();
        }
        taskService.addTask(sn);
        return "success";
    }
    @RequestMapping("/addContent")
    public String addContent(String content){
        if(StrUtil.isBlank(content)){
            content = IdUtil.fastSimpleUUID();
        }
        taskService.addContent(content);
        return "success";
    }
}
